// 实现这个项目的构建任务
const {src, dest, parallel} = require('gulp')
const sass = require('gulp-sass')
const babel = require('gulp-babel')
const swig = require('gulp-swig')
const imagemin = require('gulp-imagemin')
//样式文件
const style = () => {
    return src('src/assets/styles/*.scss', {base:'src'})
    .pipe(sass())
    .pipe(dest('dist'))
}
//js文件
const script = () => {
    return src('src/assets/scripts/*.js',{base:'src'})
    .pipe(babel())
    .pipe(dest('dist'))
}
const page = () => {
    return src('src/*.html',{base:'src'})
    .pipe(swig())
    .pipe(dest('dist'))
}
const image = () =>{
    return src('src/assets/images/**',{base:'src'})
    .pipe(imagemin())
    .pipe(dest('dist'))
}
const font = () =>{
    return src('src/assets/fonts/**',{base:'src'})
    .pipe(imagemin())
    .pipe(dest('dist'))
} 
const compile = parallel(style,script,page,image,font)
module.exports = {
    compile
}
